home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Beta / Quicktime 2.0 Beta.iso / Extensions / Macintosh Easy Open / Documentation / Developer / Interfaces / AIncludes / Translation.a next >
Encoding:
Text File  |  1993-04-28  |  5.6 KB  |  163 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Translation.a
  3. ;
  4. ;    Contains:    Public Interface definitions to TranslationMgr.
  5. ;    
  6. ;    Copyright:    © 1992-1993 by Apple Computer, Inc., all rights reserved.
  7. ;
  8.  
  9.     IF &TYPE('__INCLUDINGTRANSLATION__') = 'UNDEFINED' THEN
  10. __INCLUDINGTRANSLATION__    SET    1
  11.  
  12.  
  13.     IF &TYPE('_TranslationDispatch') = 'UNDEFINED' THEN            ; ••• to be removed
  14. _TranslationDispatch        opword    $ABFC                        ; ••• to be removed
  15.     ENDIF                                                        ; ••• to be removed
  16.  
  17.  
  18. gestaltTranslationAttr                EQU        'xlat'                ; ••• move into GestaltEqu.a
  19. gestaltTranslationMgrExists            EQU        0                    ; ••• move into GestaltEqu.a
  20. gestaltTranslationMgrHintOrder        EQU        1                    ; True if hint order reversal fix in effect 
  21.  
  22. gestaltScrapMgrAttr                    EQU        'scra'                ; ••• move into GestaltEqu.a
  23. gestaltScrapMgrTranslationAware        EQU        0                    ; ••• move into GestaltEqu.a
  24.  
  25. ;gestaltStandardFileAttr            EQU        'stdf'
  26. ;gestaltStandardFile58                EQU        0
  27. gestaltStandardFileTranslationAware    EQU        1                    ; ••• move into GestaltEqu.a
  28. gestaltStandardFileHasColorIcons    EQU        2                    ; ••• move into GestaltEqu.a
  29.  
  30. ;gestaltEditionMgrAttr                EQU        'edtn'
  31. ;gestaltEditionMgrPresent            EQU        0
  32. gestaltEditionMgrTranslationAware    EQU        1                    ; ••• move into GestaltEqu.a
  33.  
  34.  
  35. ; error codes
  36. noTranslationPathErr                EQU        -3030                ; ••• move into Errors.a
  37. badTranslationSpecErr                EQU        -3031                ; ••• move into Errors.a
  38. noPrefAppErr                        EQU        -3032                ; ••• move into Errors.a
  39.  
  40.  
  41. FileTranslationSpec     RECORD 0
  42. data                    DS.L    12        
  43. size                    EQU        *
  44.                      ENDR        
  45.  
  46. ; DocOpenMethod = enumerated types on how a document can be opened
  47. domCannot                EQU        0
  48. domNative                EQU        1
  49. domTranslateFirst        EQU        2
  50. domWildcard                EQU        3
  51.  
  52.  
  53. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  54. ;
  55. ; This routine returns a list of all FileTypes that an application can open by itself
  56. ;
  57. ; Enter:    appVRefNumHint        volume where application resides (can be wrong, and if is, will be used as a starting point)
  58. ;            appSignature        signature (creator) of application
  59. ;            nativeTypes            pointer to a buffer to be filled with up to 64 FileTypes
  60. ;
  61. ; Exit:        nativeTypes            zero terminated array of FileTypes that can be opened by app
  62. ;
  63. ;    FUNCTION GetFileTypesThatAppCanNativelyOpen(appVRefNumHint    : INTEGER;
  64. ;                                                appSignature    : OSType; 
  65. ;                                            VAR nativeTypes        : TypesBlock) :OSErr;
  66.         MACRO
  67.         _GetFileTypesThatAppCanNativelyOpen
  68.         MOVEQ    #$1C,D0
  69.         _TranslationDispatch
  70.         ENDM
  71.     
  72.     
  73. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  74. ;
  75. ; This routine makes a new list of file types that can be translated into a type in the given list
  76. ; Used by StandardFile
  77. ;
  78. ; Enter:    originalTypeList        pointer to list of file types that can be opened
  79. ;            numberOriginalTypes        number of file types in orgTypeList
  80. ;             extendedTypeList        pointer to a buffer to be filled with file types
  81. ;            numberExtendedTypes        max number of file types that can be put in extendedTypeList
  82. ;
  83. ; Exit:        extendedTypeList        buffer filled in with file types that can be translated
  84. ;            numberExtendedTypes        number of file types put in extendedTypeList
  85. ;
  86. ;    FUNCTION ExtendFileTypeList(    originalTypeList    : SFTypeList;
  87. ;                                    numberOriginalTypes    : INTEGER; 
  88. ;                                VAR extendedTypeList    : SFTypeList;
  89. ;                                VAR numberExtendedTypes    : INTEGER) : OSErr;
  90. ;
  91.         MACRO
  92.         _ExtendFileTypeList
  93.         MOVEQ    #$9,D0
  94.         _TranslationDispatch
  95.         ENDM
  96.     
  97.  
  98.  
  99.  
  100. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  101. ;
  102. ; This routine checks if a file can be opened by a particular application.
  103. ; If so, it returns if it needs to be translated first, and if so then how.
  104. ; The FileTypes that the app can open are specified by nativelyOpenableTypes,
  105. ; or if it is NULL, GetFileTypesThatAppCanNativelyOpen is called.
  106. ;
  107. ; Enter:    targetDocument        document to check if it can be opened
  108. ;            appVRefNumHint        vRefNum of application to open doc ( can be wrong, and if is, will be used as a starting point)
  109. ;            appSignature        signature (creator) of application to open doc
  110. ;            nativeTypes            zero terminated list of FileTypes app can open natively, or NULL to use default list
  111. ;            onlyNative            whether to consider if document can be translated before opening
  112. ;            howToOpen            pointer to buffer in which to put how the document can be opened
  113. ;            howToTranslate        pointer to buffer in which to put a FileTranslationSpec record
  114. ;
  115. ; Exit:        howToOpen            whether file needs to be translated to be read
  116. ;            howToTranslate        if file can be translated, buffer filled in with how to translate
  117. ;            returns                noErr, noPrefAppErr
  118. ;
  119. ;    FUNCTION CanDocBeOpened(    targetDocument    : FSSpec; 
  120. ;                                appVRefNumHint    : INTEGER; 
  121. ;                                appSignature    : OSType; 
  122. ;                                nativeTypes        : TypesBlockPtr; 
  123. ;                                onlyNative         : Boolean;
  124. ;                            VAR howToOpen        : DocOpenMethod; 
  125. ;                            VAR howToTranslate    : FileTranslationSpec) : OSErr;
  126. ;
  127.         MACRO
  128.         _CanDocBeOpened
  129.         MOVEQ    #$1E,D0
  130.         _TranslationDispatch
  131.         ENDM
  132.     
  133.  
  134.  
  135. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  136. ;
  137. ;  TranslateFile
  138. ;
  139. ; This routine reads a file of one format and writes it to another file in another format. 
  140. ; The information on how to translated is generated by the routine CanDocBeOpened.
  141. ; TranslateFile calls through to the TranslateFile Extension's DoTranslateFile routine.  
  142. ; The destination file must not exist.  It is created by this routine.  
  143. ;
  144. ; Enter:    sourceDocument            input file to translate
  145. ;            destinationDocument        output file of translation
  146. ;            howToTranslate            pointer to info on how to translate
  147. ; Exit:        returns                    noErr, badTranslationSpecErr 
  148. ;
  149. ;    FUNCTION TranslateFile(sourceDocument        : FSSpec; 
  150. ;                           destinationDocument    : FSSpec; 
  151. ;                           howToTranslate        : FileTranslationSpec) : OSErr;
  152. ;
  153.         MACRO
  154.         _TranslateFile
  155.         MOVEQ    #$0C,D0
  156.         _TranslationDispatch
  157.         ENDM
  158.     
  159.     
  160.     
  161.     ENDIF    ; ...already included 
  162.     
  163.